package com.example.therDays.ui.components


import android.app.Notification.Style
import android.text.style.AlignmentSpan
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Icon
import androidx.compose.material.Text
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Refresh
import androidx.compose.material.icons.filled.Send
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color

import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.example.therDays.R


@Composable
fun WeatherCard(NavWeather:()->Unit) {
    Box(
        Modifier
            .fillMaxWidth()
            .height(200.dp)
            .padding(horizontal = 8.dp, vertical = 16.dp)
            .clip(RoundedCornerShape(12.dp))
            .background(
                Brush.linearGradient(
                    listOf(Color(0xFF335FD1), Color(0xFF4F7FFA)),
                    start = Offset(x = 1000f, y = 600f),
                    end = Offset(x = 0f, y = 0f)
                )
            ).clickable(indication = null, interactionSource = remember {
                MutableInteractionSource()
            }) {
                 NavWeather.invoke()
            },
    ) {
        Column(
            verticalArrangement = Arrangement.SpaceAround,
            horizontalAlignment = Alignment.CenterHorizontally,
            modifier = Modifier.fillMaxSize(),

        ) {
            Row(
                modifier = Modifier
                    .height(40.dp)
                    .fillMaxWidth()
                    .padding(horizontal = 20.dp),
                verticalAlignment = Alignment.CenterVertically,
                horizontalArrangement = Arrangement.SpaceBetween
            ) {
                Text(text = "2023年07月19日")
                Text(text = "12:07 PM")
            }
            Row(
                verticalAlignment = Alignment.CenterVertically,
                horizontalArrangement = Arrangement.Start,
                modifier = Modifier
                    .fillMaxHeight(0.5f)
                    .fillMaxWidth()
                    .padding(horizontal = 8.dp)
            ) {
                Image(painter = painterResource(
                    id = R.drawable.group21),
                    contentDescription =null,
                    Modifier
                        .background(Color.Transparent)
                        .size(size = 70.dp))
                Column(
                    verticalArrangement = Arrangement.Center
                ) {
                    Text(text = "18°C", style = TextStyle(
                        fontSize = 22.sp
                    ))
                    Text(text = "今日天气", style = TextStyle(
                        fontSize = 22.sp
                    ))
                }
            }


            Row(modifier = Modifier
                .height(40.dp)
                .fillMaxWidth()
                .padding(horizontal = 12.dp),
                verticalAlignment = Alignment.CenterVertically
            ) {
                Text(text = "最近刷新时间:3:00-PM",style = TextStyle(
                    fontSize = 18.sp))
                Icon(imageVector = Icons.Default.Refresh, contentDescription =null , modifier = Modifier.padding(start = 4.dp).size(20.dp))
            }

        }
    }
}


